// s.d(t, { xc: () => i, ko: () => a, k7: () => o })
import * as THREE from "three"

function i(e) {
  const t = e.match(/group([0-9]+)/),
    s = e.match(/sub([0-9]+)/),
    r = e.match(/type([0-9]+)/),
    i = e.match(/mirror([0-9]+)/),
    a = e.match(/window([0-9]+)/),
    o = e.match(/chunk([0-9]+)/),
    n = e.match(/_chunk([0-9]+)/),
    h = r ? parseInt(r[1], 10) : i && !isNaN(parseInt(i[1], 10)) ? 100 : a && !isNaN(parseInt(a[1], 10)) ? 101 : 0
  return {
    group: t ? parseInt(t[1], 10) : 0,
    subgroup: s ? parseInt(s[1], 10) : 0,
    chunkIndex: o ? parseInt(o[1], 10) : 0,
    nodeIndex: n ? parseInt(n[1], 10) : 0,
    type: h
  }
}
function a(e, t = !1) {
  let s = e.getAttribute("barycentric")
  if (s) return s
  const i = (e.getIndex() || e.getAttribute("position")).count / 3,
    a = []
  for (let e = 0; e < i; e++) {
    const s = t ? 1 : 0
    e % 2 == 0 ? a.push(0, 0, 1, 0, 1, 0, 1, 0, s) : a.push(0, 1, 0, 0, 0, 1, 1, 0, s)
  }
  const o = new Float32Array(a)
  return (s = new THREE.BufferAttribute(o, 3)), e.setAttribute("barycentric", s), s
}
function o(e = 16777215 * Math.random(), t = 1) {
  const s = (function (e, t, s, r = 1) {
      const i = document.createElement("canvas")
      ;(i.width = t), (i.height = s)
      const a = i.getContext("2d")
      return (a.fillStyle = `rgba(${(255 * e.r) | 0},${(255 * e.g) | 0},${(255 * e.b) | 0}, ${(255 * r) | 0})`), a.fillRect(0, 0, t, s), i
    })(new THREE.Color(e), 1, 1, t),
    i = new THREE.CubeTexture([s, s, s, s, s, s])
  return (i.format = THREE.RGBAFormat), (i.needsUpdate = !0), i
}
export default {
  xc: i,
  ko: a,
  k7: o
}
